<div id="weakly_deal">
	<div><h2>Weekly Deal</h2></div>
	<div id="weakly_deal_top">
		<?php 
		if ($weakly_deal_items->RecordCount()>0){
		    $sale_discount = zen_get_products_save($weakly_deal_items->fields['products_id'],1);
		    if ($sale_discount!=''){
		    	$special_flag = '<span class="index_icon-discount-b">'.$sale_discount.'</span>';
		    }else{
		    	$special_flag = '';
		    }
		?>
		<a href="<?php echo zen_href_link(FILENAME_PRODUCT_INFO,'products_id='.$weakly_deal_items->fields['products_id'])?>">
		<?php echo $special_flag?>
		<img src="<?php echo DIR_WS_IMAGES.$weakly_deal_items->fields['products_image'] ?>" alt="<?php echo $weakly_deal_items->fields['products_name']?>" width="190px" height="190px" />
		</a>
		<div id="timer"><strong id="lblRemainTime"></strong></div>
		<?php	
		}
		?>
	</div>
	<div id="weakly_deal_bottom">
		<?php 
		$weakly_deal_items->MoveNext();
		while (!$weakly_deal_items->EOF){
			$sale_discount = zen_get_products_save($weakly_deal_items->fields['products_id'],1);
		    if ($sale_discount!=''){
		    	$special_flag = '<span class="index_icon-discount-b">'.$sale_discount.'</span>';
		    }else{
		    	$special_flag = '';
		    }	
			$products_price = $currencies->display_price((zen_get_products_actual_price($weakly_deal_items->fields['products_id'])),0);
		?>
		<div style="width:180px;float:left;">
		<a href="<?php echo zen_href_link(FILENAME_PRODUCT_INFO,'products_id='.$weakly_deal_items->fields['products_id'])?>">
		<?php echo $special_flag?>
		<img src="<?php echo DIR_WS_IMAGES.$weakly_deal_items->fields['products_image'] ?>" alt="<?php echo $weakly_deal_items->fields['products_name']?>" width="160px" height="160px" />
		</a>	
		<br />
		<a href="<?php echo zen_href_link(FILENAME_PRODUCT_INFO,'products_id='.$weakly_deal_items->fields['products_id'])?>">
		<?php echo $weakly_deal_items->fields['products_name'] ?>
		</a>
		<br />
		<div style="color:red;font-weight:bold;text-align: center;"><?php echo $products_price?></div>
		</div>
		<?php
			$weakly_deal_items->MoveNext();
		}
		?>
	</div>
</div>
<?php 
$weak = date(w)=='0'?7:date(w);//获取今天星期几
$end_date = date('Y-m-d',mktime(0, 0, 0, date("m")  , date("d")+(7-$weak), date("Y")));//距周未结束天数
list($end_y,$end_m,$end_d) = explode('-', $end_date);
?>
<script>
var SysSecond;
var InterValObj;
timenow = new Date(<?php echo date('Y')?>,<?php echo date('m')?>,<?php echo date('d')?>,<?php echo date('H')?>,<?php echo date('i')?>,<?php echo date('s')?>);
time = timenow.getTime();
endtime  = new Date(<?php echo $end_y?>,<?php echo $end_m?>,<?php echo $end_d?>,23,59,59);
end = endtime.getTime();
SysSecond = Math.floor(((end - time)/1000));
InterValObj = window.setInterval(SetRemainTime, 1000);   
function SetRemainTime() {
	if (SysSecond > 0) {
		SysSecond =SysSecond-1;
		var second = Math.floor(SysSecond % 60);               
		var minite = Math.floor((SysSecond / 60) % 60);   
		var hour = Math.floor((SysSecond / 3600) % 24);      
		var day = Math.floor((SysSecond / 3600) / 24);
		if(second<10){
			second = '0'+second;
		}
		if(hour<10){
			hour = '0'+hour;
		}
		if(minite<10){
			minite = '0'+minite;
		}
		$("#lblRemainTime").html('<span>0'+day +"</span><b>"+ hour +"</b><b>"+ minite +"</b><b>"+ second +"</b>");

	} else {
		SysSecond = SysSecond + 604800;
	}
};
</script>